<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page session="true"%>

<html> 
<head>
	<META http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Product list</title>
	<link rel="stylesheet" href="<c:url value="/resources/blueprint/screen.css" />" type="text/css" media="screen, projection">
	<link rel="stylesheet" href="<c:url value="/resources/blueprint/print.css" />" type="text/css" media="print">
	<!--[if lt IE 8]>
		<link rel="stylesheet" href="<c:url value="/resources/blueprint/ie.css" />" type="text/css" media="screen, projection">
	<![endif]-->
</head>	

<body>

<div class="container">
    <%@include file="../common/header.jsp" %>
	<h2>Product list</h2>
	<div class="span-12 last">	
		<form:form modelAttribute="product" action="delete" method="post">
            <table width="100%" border="1" cellpadding="2" cellspacing="0">
                <thead>
                    <tr>
                        <th>&nbsp;</th>
                        <th>Name</th>
                        <th>Image</th> 
                        <th>Model</th>
                        <th>Price</th>
                        <th>Stock</th>
                        <th>Status</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <c:forEach items="${products}" var="product">
                    <tr>
                        <td><input type="checkbox" name="id" value="${product.id}"/></td>
                        <td><c:out value="${product.name}"/></td>
                        <td>
                   			<img src="<c:url value="/images/${product.img1}"/>" />
						</td>
                        <td><c:out value="${product.model}"/></td>
                        <td><c:out value="${product.price}"/></td>
                        <td><c:out value="${product.stock}"/></td>
                        <td><c:out value="${product.status}"/></td>
                        <td><a href="${product.id}">Edit</a></td>
                    <tr/>
                    </c:forEach>
    
                </tbody>
            </table>
            <input type="button" value="Create Product" onclick="location.href='create';"/> &nbsp;&nbsp; <input type="submit" value="Delete selected product"/>
		</form:form>
	</div>
    <%@include file="../common/footer.jsp" %>
</div>
</body>
</html>